/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FrameWork.Objects.Items;

import FrameWork.GameScreen;
import FrameWork.Objects.MyObject;
import FrameWork.PSWater;
import GamePlay.Global;
import java.io.IOException;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author ASUS
 */
public class Water extends Items{
    private PSWater psWater;
    public Water(int _X,int _Y, int _SizeX, int _SizeY,
            float _TimeAni, 
            int _Map[][],int _Width, int _Height,
            int _ID) throws IOException{     
        super(_X, _Y, _SizeX, _SizeY, _TimeAni, _Map, _Width, _Height, _ID);
        m_CurFrame = 12;
        psWater = new PSWater(_X, _Y);
        psWater.Init();
//        m_STATUS = Global.STT_INVI;
    }
    public void Update (float _Time,int _Terrain[][]){
        UpdateAnimation(_Time);
        switch(m_STATUS){
            case Global.STT_INVI:
                m_TimeUpdate+=_Time;
                if(m_TimeUpdate>=1.0f){
                    m_TimeUpdate=0;
                    m_STATUS = Global.STT_ACTIVE;
                }
                break;
            case Global.STT_DEATH:
                psWater.Update(_Time);
                m_TimeUpdate+=_Time;
                if(m_TimeUpdate>=1.0f){
                    m_TimeUpdate = 0;
                    m_OldStatus = Global.STT_DEATH;
                }
                break;
        }
    }
    public void UpdateAnimation (float _Time){
    }
    public void ActionCollision (MyObject _Object){
        if (_Object.getID()!=Global.ID_FIREMAN) return;
        
    }
     public void DrawScreen (Graphics _Graphics,GameScreen _Screen){
        switch(m_STATUS){
            case Global.STT_INVI:
                if(m_Ran.nextInt(2)==0){
                    super.DrawScreen(_Graphics, _Screen);
                }
                break;
            case Global.STT_ACTIVE:
                super.DrawScreen(_Graphics, _Screen);
                break;
            case Global.STT_DEATH:
                psWater.DrawScreen(_Graphics, _Screen);
                break;
        }
    }
}
